<?php    
    # Suorita haku
    $search = API::workoutSearch(array(
        "user_weight_hashid" => $_POST["hashid"]
    ));
?>

<table class="table table-striped">
    <thead>
        <tr>
            <th>
                #
            </th>
            <th>
                Name/desc
            </th>
            <th>
                Date
            </th>
            <th>
                &nbsp;
            </th>
        </tr>
    </thead>
    
    <tbody>
        <?php
            $i = 1;
            $list = (array)arrGet($search,"list");
            foreach ($list as $row) {
                $extratext = htmlescape($row["extratext"]);
                $hashid = htmlescape($row["hashid"]);
        ?>
            <tr>
                <td>
                    <?php echo $i; ?>
                </td>
                <td>
                    <a class="a-subview-dialog"
                      data-ui-view="list"
                      data-ui-subview="info"
                      data-ui-title="<?php echo $extratext; ?>"
                      data-hashid="<?php echo $hashid; ?>"
                      href="#">
                        <?php echo $extratext; ?>
                    </a>
                </td>
                <td>
                    <?php echo date("Y-m-d",strtotime($row["starttime"])); ?>
                </td>
                <td>
                    <a class="a-navigation"
                      data-hashid="<?php echo $hashid; ?>"
                      data-ui-view="editworkout"
                      href="#">
                        EDIT
                    </a>
                </td>
            </tr>
        <?php
                $i++;
            }
        ?>
    </tbody>
</table>